Repository navigation
Several AI connections at once, one per provider - #2069
Draft
guidovizoso wants to merge 13 commits into
Draft
guidovizoso wants to merge 13 commits into
guidovizoso wants to merge 13 commits into
Conversation
List, connect, remove and make default the organization's AI connections and a person's own, and sign the organization in to a provider the way a person signs in. The single-connection operations keep their meaning and describe the default connection. The model catalogue lists each connection's models, a model choice names its connection and says when it stopped, and a Bot's default model input can name its source. Every new field is optional, so an older client sends and reads what it did.
AI model, Your AI and Admin, Providers draw one row per connection where the server lists them: the default tagged once there are two, Make default, Change and Disconnect in each row's dialog, and Connect another AI with the shared chooser in a new adding mode. Disconnecting the default asks which connection takes over and makes it the default first. Connections with no default say so. The organization's sign-ins go through its own sign-in operations. Against a server older than the list, or with nothing connected yet, the sections draw the one row they drew before.
… connection With several connections the composer's picker lists each one's models under its name, the default first, and a stopped connection's group says why in place of its models. Picking saves the connection with the model, so the same model on two connections is two choices and changing the default never moves a pick. A pick whose connection is gone shows the default and saves nothing; with no default the picker asks to choose. With one connection it is the picker it was.
After a refused turn the conversation reads its model choice again. When the server says the connection the next run would use is connected but can't run, a notice under the turn gives its sentence, Reconnect into that connection's row in Settings for whoever can fix it, and Choose another model, which opens the composer's picker. The picker's trigger carries a warning mark meanwhile. Nothing reads the refusal's own words, and an older server draws nothing new.
A Bot is shared and each person runs it on their own connections, so its default keeps naming a kind of connection. With several connections it applies on the first ready connection of that kind that lists the model, not only on the one in use, and falls back to the default connection's default otherwise. The Default model section picks from the grouped list and saves the group's kind as the source; with one connection it sends none, as before.
…tays put When an older app disconnects the default and one connection is left, the picker names it so a conversation can still run on it. A pick on a connection that stopped working is shown on that connection, by its id if the connection lists nothing, instead of moving to the default's model.
…efault The sentence after Connect another AI or a row's Change read whether the new connection is the default from the list as it stood, and was wrong with no default or when the default's own provider was connected again. It now follows the server's answer.
A conversation's Reconnect link now says whose connection it is, and only that list in Settings opens its row: on OpenBot Cloud an admin's own connection and the organization's may share an id, and both dialogs used to open. The API says ids are unique within their list only.
In Settings a stopped row's dialog leads with Sign in again or Replace key, which opens the chooser on that provider under a title naming the fix. In the model picker, a stopped connection of the person's own gets a Reconnect link in its group; the organization's waits on an admin.
When the last connection that can run is disconnected, the confirm step uses the sentences the single connection's dialogs always used: a person's runs fall back to the organization's AI, the organization's on OpenBot Cloud leaves only people with their own, otherwise Bots can't run. A person left with no AI where one is required is sent to connect one again.
As agreed for the backend: when a removal leaves exactly one AI connection, the server makes it the default, so disconnecting the default with one other left asks nothing. With more left and none the default, a run with no pick is refused and the conversation's model choice says so (stopped, no-default), and the notice links to choosing a default. Organization sign-ins are offered on OpenBot Cloud and a self-hosted OpenBot; OpenBot Desktop keeps its own plan sign-in.
…rs do Since TrustedRouter, a provider in an answer is AiConnectionProviderAnswer, so a released app doesn't break when one is added. The connection list and the catalogue's connections now use it too, and the app's names accept a provider it doesn't know.
…lt example that can happen Words for three new audit events the backend records: the organization's or a person's default AI changed, and an organization sign-in. The example of connections with no default now shows two left, since one left becomes the default.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Several AI connections at once, one per provider. A person who pays for a Claude plan and a ChatGPT plan, or holds a few keys, keeps all of them connected and picks a model from any of them per conversation, instead of switching one connection that moves every Bot and conversation.
API (
api/openapi/model-connections.yaml,bots.yaml). Only grows; nothing existing changes meaning. Today's single-connection operations describe the default connection.listAiConnections,connectAiConnection,removeAiConnection,makeAiConnectionDefaultunder/ai-connections./people/{personId}/ai-connections.startAiSignIn,getAiSignIn,finishAiSignInunder/ai-connection-sign-ins, as the personal ones, on OpenBot Cloud and a self-hosted OpenBot. OpenBot Desktop running its own OpenBot keeps its own plan sign-in (signInsempty).ModelCatalogue.connections(each connection's models,owner,source,ready,problem),ModelChoice.connectionandstopped,ModelChoiceInput.connection, and a Bot'sdefaultModelinputsource.stoppedchoice (no-default). Ids are unique within their list only.App.
The backend half follows and is pinned to this branch. Draft until it is in.
Where it runs
Boundary and audit
API and database
api/and keeps every rule: only new operations and optional fields, new answer enums open (x-extensible-enum, never reachable from a request), no key or address in any answer, and the existing operations keep their meaning so a released app behaves as before. No database change in this repository.Changelog
CHANGELOG.mdunderUnreleased, API.Proof
bun run api:lint,bun test api/(78 pass),bun run format:check,bun run lint,bun run typecheck.OPENBOT_APP_BROWSER=1, 58 pass).